package com.jacky.dubbo3.standalone;

import org.apache.zookeeper.server.ZooKeeperServerMain;

/**
 * 第一种启动一个内嵌的单例zk服务的方式
 */
public class ZkEmbeddedServerTwo {

    private final String tickTime;
    private final String dataDir;
    private final String clientPort;
    private final String maxCnXn;

    /**
     * @param tickTime   zk中最小时间单元的长度
     * @param dataDir    zk服务器存储快照文件的目录
     * @param clientPort 对外服务端口
     * @param maxCnXn    客户端最大连接数,通过IP来区分不同的商户端
     */
    public ZkEmbeddedServerTwo(String tickTime, String dataDir, String clientPort, String maxCnXn) {
        this.tickTime = tickTime;
        this.dataDir = dataDir;
        this.clientPort = clientPort;
        this.maxCnXn = maxCnXn;
    }

    public void start() {
        ZooKeeperServerMain.main(new String[]{tickTime, dataDir, clientPort, maxCnXn});
    }
}
